import datetime

## strftime 将日期转换成字符串
# datetime 精确到秒
print(datetime.datetime.today().strftime("%Y-%m-%d %H:%M:%S"))
# date 只能精确到天
print(datetime.date.today().strftime("%Y-%m-%d %H:%M:%S"))

## strptime 将字符串转换成日期
day1 = '2025-09-25 00:00:01'
day2 = '2025-09-25 02:00:01'
print(datetime.datetime.strptime(day1, "%Y-%m-%d %H:%M:%S"))
# 直接用 > < 比较两个datetime
print(datetime.datetime.strptime(day1, "%Y-%m-%d %H:%M:%S") > datetime.datetime.today())
print(datetime.datetime.strptime(day2, "%Y-%m-%d %H:%M:%S") > datetime.datetime.today())
